﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;

namespace ConfExpert.Forms.SatinAlma.YeniYapi.Confirmation
{
    public partial class DuzeltY2 : XForm
    {
        public DuzeltY2()
        {
            InitializeComponent();
        }

        private void DuzeltY2_Load(object sender, EventArgs e)
        {
            gridView1.Init("DuzeltY2");
            gridView1.AddDetailGrid(gridView2, "AyrimlarId", 1);
            gridView1.AddDetailGrid(gridView3, "AyrimlarId", 2);

            gridView2.YanYanaGetir("KonfMt:EklenmeTarihi");
            gridView1.AddSummary();
            gridView1.BestFitColumns();
            gridView2.BestFitColumns();
            gridView3.BestFitColumns();

            gridView1.MakeReadOnly();
            gridView2.MakeReadOnly();
            //gridView3.MakeReadOnly();

            barButtonItem1.ItemClick += barButtonItem1_ItemClick;
            gridView1.FocusedRowChanged += gridView1_FocusedRowChanged;
        }

        void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            gridView2.BestFitColumns();
            gridView3.BestFitColumns();
        }

        void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gridView3.EndEditing();
            gridView3.Update("YuklemeLinesId,YuklemeId,AyrimlarId,YuklenenMt,Fiyat,MasrafKalemiId,Degisim,KonfId", "YuklemeLines");
        }
    }
}
